//
//  XYwords.m
//  英汉词典
//
//  Created by qianfeng on 15/8/11.
//  Copyright (c) 2015年 qianfeng. All rights reserved.
//

#import "XYwords.h"

@implementation XYwords

- (id) initWithArray:(NSArray *)array{
    if (self = [super init]) {
        _English = [array objectAtIndex:0];
        NSString * str = [array objectAtIndex:1];
        NSMutableArray * tarray = (NSMutableArray *)[str componentsSeparatedByString:@" "];
         NSLog(@"%@",tarray);
        
        //取出类型
        NSString * typestr = [tarray objectAtIndex:0];
        NSRange range = [typestr rangeOfString:@":"];
        _type = [typestr substringFromIndex:range.location + 1];
            NSLog(@"%@",typestr);
        
        
        if (tarray.count > 1) {
            [tarray removeObjectAtIndex:0];
        }
        _Chinese = [tarray componentsJoinedByString:@" "];
        NSLog(@"%@",_Chinese);
         
       
    }
    return self;
}

- (NSString * ) description{

    return  [NSString stringWithFormat:@"%@ %@ %@",_English,_type,_Chinese];

}


@end
